/**
 * \file cell.h
 * \brief Cell class header
 * \author Marc Laval
 * \version 0.1
 * \date 10/2011
 *
 */

#include "defines.h"
#include "types.h"
#include <SDL/SDL.h>

#ifndef _CELL_H_
#define _CELL_H_

/*!
 * \class Cell
 * \brief Class representing a cell of the map
 */
class Cell {

public :

    /*! \brief Default constructor */
	Cell();

	/*! \brief Constructor */
    Cell::Cell(CellType type, uint16 tileNum)

	/*! \brief Destructor */
	~Cell();

    /*! \brief Cell type getter
     *  \return cell type
     */
	CellType getCellType();

	/*! \brief Cell type setter
     *  \param type cell type
     */
	void setCellType(CellType type);

    /*! \brief Item getter
     *  \return item pointer. value is null if there is no item on the cell.
     */
	Item* getItem();

    /*! \brief Item setter
     *  \param item Pointer to the item. null for no item.
     */
	void setItem(Item* item);

    /*! \brief Paint the cell on the screen.
     *  \param screen display area
     *  \param The place to draw inside the display area (graphic context)
     */
    void paint(SDL_Surface * screen, SDL_Rect * r);


    /*!
     * \brief CellType type definition
     */
    enum CellType { ctGround = 1,
                    ctLowObstacle = 2,
                    ctHighObstacle = 3,
                    ctHole = 4};

private:
	/*! \brief Cell type */
	CellType m_type;

	/*! \brief Item on the cell */
	Item * m_item;

    /*! \brief number of the tile to display */
	uint16 m_tileNum;

    /*! \brief Serialize the cell
     *  \param buff Pointer to the byte buffer to store the serialized data
     *  Mainly used to save the map into a file.
     */
    void serialize(ByteBuffer * buff)

    /*!  \brief Deserilize the cell from the byte buffer
     *   \param buff The buffer containing the serialized data
     *   \return Pointer to the new instance of cell created from deserialization
     */
    static Cell* deserialize(ByteBuffer * buff);

	friend class Map;
};


#endif //_CELL_H_
